package scparser.factory.primitiveFactory;

import java.util.Iterator;
import java.util.List;
import raycast.Scene;
import model.Shader;
import model.primitive.Primitive;

public abstract class PrimitiveFactory implements PrimitiveAbstractFactory{
	protected Scene scene;
	protected String name;
	protected Shader shader;

	@Override
	public abstract Primitive create(List<String> block) throws PrimitiveFactoryException;
	
	protected Shader getShader(String shaderName) {
		Iterator<Shader> it = this.scene.getShaders().iterator();
		while (it.hasNext()) {
			Shader next = it.next();
			if (next.getName().equals(shaderName)) {
				return next;
			}
		}
		return null;
	}

}
